package org.loong.crypto.service.core.provider.impl;

import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;

import org.loong.crypto.core.algorithm.SignatureAlgorithm;

/**
 * The base abstract class for SM2 signers and verifiers.
 * 
 * <p>
 * Supports the following algorithms:
 *
 * <ul>
 * <li>{@link org.loong.crypto.core.algorithm.SignatureAlgorithm#SHA1_SM2}
 * <li>{@link org.loong.crypto.core.algorithm.SignatureAlgorithm#SHA256_SM2}
 * <li>{@link org.loong.crypto.core.algorithm.SignatureAlgorithm#SM3_SM2}
 * </ul>
 */
public abstract class SM2Provider extends BaseSignatureProvider {

    /**
     * The supported signature algorithms by the SM2 provider class.
     */
    public static final Set<SignatureAlgorithm> SUPPORTED_ALGORITHMS;

    static {
        Set<SignatureAlgorithm> algs = new LinkedHashSet<>();
        algs.add(SignatureAlgorithm.SHA1_SM2);
        algs.add(SignatureAlgorithm.SHA256_SM2);
        algs.add(SignatureAlgorithm.SM3_SM2);
        SUPPORTED_ALGORITHMS = Collections.unmodifiableSet(algs);
    }

    /**
     * Creates a new SM2 provider.
     */
    protected SM2Provider() {
        super(SUPPORTED_ALGORITHMS);
    }
}
